<style>
    .layui-form-label {
        width: 100px;
    }
    
    .layui-form-item {
        margin-bottom: 0;
    }
    
    .l-t {
        text-align: left;
        padding-left: 0;
        width: auto;
    }
    
    .apply-imgs {
        max-width: 320px;
        max-height: 320px;
        border-radius: 5px;
    }
</style>
<input type="hidden" name="id" id="id" value="{$id}"> 
<div class="layui-form-item">
    <label class="layui-form-label">订单号</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {$id}
        </label>
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">下单时间</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {$ct}
        </label>
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">支付时间</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {$pay_time}
        </label>
    </div>
</div>
{if condition="($Think.session.admin_info.permission==10)"}

<div class="layui-form-item">
    <label class="layui-form-label">交易号</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {$transaction_id}
        </label>
    </div>
</div>
{/if}
<div class="layui-form-item">
    <label class="layui-form-label">状态</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {$status}
        </label>
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">寄件信息</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {$sender_name}
            {$sender_phone}
        </label>
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">收货信息</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {volist name="address" id="vo"}
            {$express=='顺丰'?"【要求顺丰】":''}
            {$vo.consignee}
            {$vo.phone}
            {$vo.address}
            {/volist}
        </label>
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">快递信息</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {volist name="address" id="vo"}
            {$vo.express_name}
            {$vo.express_number}
            {/volist}
            [{$send_time}]
        </label>
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">商品信息</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {volist name="product" id="vo"}
            {$vo.name}
            [{$vo.specifications}]
            x{$vo.number}
            {/volist}
        </label>
    </div>
</div>

<div class="layui-form-item">
    <label class="layui-form-label">总金额</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {if condition="($Think.session.admin_info.permission==6)"}
            ￥{$total_real_supply+$total_postage} {$total_postage>0?'(含运费'.$total_postage.'元)':''}
            {elseif condition="$Think.session.admin_info.permission==10"/}
            订单金额: ￥{$total_money}<br>
            {$total_money==$total_fee?'':'支付金额: ￥'.$total_fee.'<br>'}
            供货商供货成本: ￥{$total_real_supply}<br>
            帮主供货成本: ￥{$supply_cost}
            
            {/if}
        </label>
    </div>
</div>

{if condition="($Think.session.admin_info.permission==10)"}
<div class="layui-form-item">
    <label class="layui-form-label">购买来源</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {$from=='1'?'代客下单':'小店下单'}
        </label>
    </div>
</div>
{/if}


<div class="layui-form-item">
    <label class="layui-form-label">备注</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {$remark}
        </label>
    </div>
</div>
{if condition="($Think.session.admin_info.permission==10)"}
<div class="layui-form-item">
    <label class="layui-form-label">红包</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            红包总金额：￥{$total_red_packet}<br>
            {volist name="red_packet" id="vo"}
            {$vo.type}
            {$vo.user_name}
            ￥{$vo.money}
            {/volist}
        </label>
    </div>
</div>
{/if} 

<div class="layui-form-item">
    <label class="layui-form-label">收货时间</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {$receive_time}
        </label>
    </div>
</div>

{if condition="($status=='申请退款')"}
<div class="layui-form-item">
    <label class="layui-form-label">申请退款金额</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            ￥{$apply_refund_money}
        </label>
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">申请退款时间</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {$apply_time}
        </label>
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">申请退款原因</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {$reason}
        </label>
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">申请退款详情</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {$reason_info}
        </label>
    </div>
</div>
{/if} {if condition="($status=='申请售后')"}
<div class="layui-form-item">
    <label class="layui-form-label">申请售后金额</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            ￥{$apply_refund_money}
        </label>
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">申请售后时间</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {$apply_time}
        </label>
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">申请售后原因</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {$reason}
        </label>
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">申请售后详情</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {$reason_info}
        </label>
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">申请售后图片</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {volist name="apply_imgs" id="vo"}
            <img src="{$vo}" alt="" class="apply-imgs">
            {/volist}
        </label>
    </div>
</div>
{/if} {if condition="($status=='同意退款'||$status=='退款成功')"}
<div class="layui-form-item">
    <label class="layui-form-label">同意退款时间</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {$confirm_refund_time}
        </label>
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">退款到账时间</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {$refund_time}
        </label>
    </div>
</div>
{/if} {if condition="($status=='同意退货,待买家发货'||$status=='退货成功')"}
<div class="layui-form-item">
    <label class="layui-form-label">同意退货时间</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {$confirm_return_goods_time}
        </label>
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">退款到账时间</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {$refund_time}
        </label>
    </div>
</div>
{/if} {if condition="($status=='拒绝退款')"}
<div class="layui-form-item">
    <label class="layui-form-label">拒绝退款时间</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {$confirm_return_goods_time}
        </label>
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label">拒绝退款理由</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {$reject_refund_reason}
        </label>
    </div>
</div>
{/if} {if condition="($status=='卖家待收货')"}
<div class="layui-form-item">
    <label class="layui-form-label">买家发货信息</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {$buyer_send_name}
            {$buyer_send_number}
            {$buyer_send_time}
        </label>
    </div>
</div>
{/if}

{if condition="($status=='退货成功')"}
<div class="layui-form-item">
    <label class="layui-form-label">卖家收货时间</label>
    <div class="layui-input-block">
        <label class="layui-form-label l-t">
            {$seller_receive_time}
        </label>
    </div>
</div>
{/if}

<div class="layui-form-item" style="margin-top: 20px;">
    <div class="layui-input-block">
        {if condition="($status=='待发货')"}
        <button class="layui-btn send"><i class="layui-icon layui-icon-upload-circle"></i>发货</button>
        <button class="layui-btn layui-btn-danger cancel"><i class="layui-icon layui-icon-close"></i>取消订单</button>
        {elseif condition="($status=='申请退款')"}
        <button class="layui-btn send"><i class="layui-icon layui-icon-upload-circle"></i>发货</button>
        <button class="layui-btn layui-btn-normal confirmRefund"><i class="layui-icon layui-icon-ok"></i>确认退款</button> 
        {elseif condition="($status=='申请售后')"}
        <button class="layui-btn layui-btn-normal confirmRefund"><i class="layui-icon layui-icon-ok"></i>同意退货</button>
        <button class="layui-btn layui-btn-danger rejectRefund"><i class="layui-icon layui-icon-close"></i>拒绝退货</button>
        {elseif condition="($status=='卖家待收货')"}
        <button class="layui-btn layui-btn-normal confirmReceipt"><i class="layui-icon layui-icon-download-circle"></i>确认收货</button>
        {/if}
    </div>
</div>

<script>
    layui.use(['http'], function () {
        var http = layui.http;
        var $ = layui.$;
        $(".send").click(function () {
            var url = '/order/sendGoods?id=' + $("#id").val()
            var title = '发货'
            http.get(url, title);
        })
        $(".cancel").click(function () { 
            http.post('/order/cancelorder', {
                order_id: $("#id").val()
            }, function (res) {
                window.location.reload()
            })
        })        
        $(".confirmRefund").click(function () {
            http.post('/order/confirmRefund', {
                order_id: $("#id").val()
            }, function (res) {
                window.location.reload()
            })
        })
        $(".rejectRefund").click(function () {
            var pindex = layer.prompt({
                title: '拒绝理由',
                formType: 2
            }, function (val, index) {
                // layer.msg('得到了'+val);
                http.post('/order/rejectRefund', {
                    order_id: $("#id").val(),
                    reason: val
                }, function (res) {
                    layer.close(pindex);
                    window.location.reload()
                })
            });
        })
        $(".confirmReceipt").click(function () {
            http.post('/order/confirmReceipt', {
                order_id: $("#id").val(),
            }, function (res) {
                window.location.reload()
            })
        })
    })
</script>